package handler

import (
	"gin/api/request"
	"gin/global/model"
	classtype "gin/srv"
	"net/http"

	"github.com/gin-gonic/gin"
)

func ClassTypeDelete(context *gin.Context) {
	var C request.ClassTypeDelete
	if err := context.ShouldBind(&C); err != nil {
		context.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
		return
	}
	typeDelete, err := model.ClassTypeConn.ClassTypeDelete(model.Ctx, &classtype.ClassTypeDeleteRequest{
		Id: int64(C.Id),
	})
	if err != nil {
		context.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
		return
	}
	context.JSON(http.StatusOK, gin.H{"data": typeDelete})
}
